<template>
    <div class="home">
        <mt-swipe :auto="4000">
            <mt-swipe-item v-for="(item,index) in list" :key="index">
                <img :src="item.img" :alt="item.url">
            </mt-swipe-item>
        </mt-swipe>
        <div class="mui-content">
            <ul class="mui-table-view mui-grid-view mui-grid-9">
                <li class="mui-table-view-cell mui-media mui-col-xs-4 mui-col-sm-3">
                    <router-link to="/home/newslist">
                        <span class="mui-icon news"></span>
                        <div class="mui-media-body">新闻咨询</div>
                    </router-link>
                </li>
                <li class="mui-table-view-cell mui-media mui-col-xs-4 mui-col-sm-3"><a href="#">
                    <span class="mui-icon photo"></span>
                    <div class="mui-media-body">图片分享</div>
                </a></li>
                <li class="mui-table-view-cell mui-media mui-col-xs-4 mui-col-sm-3"><a href="#">
                    <span class="mui-icon buy"></span>
                    <div class="mui-media-body">商品购买</div>
                </a></li>
                <li class="mui-table-view-cell mui-media mui-col-xs-4 mui-col-sm-3"><a href="#">
                    <span class="mui-icon feedback"></span>
                    <div class="mui-media-body">留言反馈</div>
                </a></li>
                <li class="mui-table-view-cell mui-media mui-col-xs-4 mui-col-sm-3"><a href="#">
                    <span class="mui-icon video"></span>
                    <div class="mui-media-body">视频专区</div>
                </a></li>
                <li class="mui-table-view-cell mui-media mui-col-xs-4 mui-col-sm-3"><a href="#">
                    <span class="mui-icon contact"></span>
                    <div class="mui-media-body">联系我们</div>
                </a></li>
            </ul>
        </div>
    </div>
</template>

<script>
    export default {
        created() {
            this.$http.get('api/getlunbo').then(resp => {
                var data = resp.data;
                if (data.status === 0) {
                    this.list = data.message
                }
            })
        },
        data() {
            return {
                list: []
            }
        }
    }
</script>

<style lang="scss">
    .home {

        .mint-swipe {
            background-color: lightblue;
            height: 180px;

            img {
                width: 100%;
                height: 100%;
            }
        }

        // 九宫格顶部空隙（间隔）
        .mui-content > .mui-table-view:first-child {
            margin-top: 0;
        }
        // 处理九宫格的背景色
        .mui-grid-view.mui-grid-9 {
            background-color: #fff;
        }
        // 处理九宫格的边框
        .mui-grid-view.mui-grid-9 .mui-table-view-cell {
            border: 0;
        }

        // 展示每个菜单的小图标
        .mui-icon {
            width: 60px;
            height: 60px;
            // 让 背景图片 填满整个宽度和高度
            background-size: cover;
        }
        .news {
            background-image: url(../../images/menu1.png);
        }
        .photo {
            background-image: url(../../images/menu2.png);
        }
        .buy {
            background-image: url(../../images/menu3.png);
        }
        .feedback {
            background-image: url(../../images/menu4.png);
        }
        .video {
            background-image: url(../../images/menu5.png);
        }
        .contact {
            background-image: url(../../images/menu6.png);
        }
    }
</style>
